package chapter05

/**
 *
 * @author cdhuangchao3
 * @date 2023/6/4 8:55 PM
 */
object Test08_Practice {
  def main(args: Array[String]): Unit = {
    def func(i: Int): String => (Char => Boolean) = {
      def f1(s: String): Char => Boolean = {
        def f2(c: Char): Boolean = {
          !(i == 0 && s == "" && c == '0')
        }

        f2
      }

      f1
    }

    println(func(1)("")('0'))

    def func1(i: Int): String => (Char => Boolean) = {
      s => c => !(i == 0 && s == "" && c == '0')
    }

    println(func1(0)("")('0'))

    // 柯里化
    def func2(i: Int)(s: String)(c: Char): Boolean = {
      !(i == 0 && s == "" && c == '0')
    }

    println(func2(0)("")('0'))

  }
}
